package roborally.pathfinding;

import roborally.model.Position;

/**
 * A class used for path-finding algorithm for robots.
 * 
 * @author  Pieter Robberechts	(1e Bach Informatica)
 * @author	Jeroen Sanders		(1e Bach Informatica)
 */
public class Node{
	
	Node(Node parent,Position position,double gCost,double hCost) {
		this.setParent(parent);
		this.setPosition(position);
		this.setgCost(gCost);
		this.sethCost(hCost);
	}
	
	/**
	 * Holds the parent node of the current node.
	 */
	private Node parent;
	
	public void setParent(Node parent){
		this.parent = parent;
	}
	
	public Node getParent() {
		return this.parent;
	}
	
	/**
	 * Holds the position of the node.
	 */
	private Position position;
	
	public Position getPosition() {
		return position;
	}

	public void setPosition(Position position) {
		this.position = position;
	}
	
	/**
	 * Holds the movement cost to move from the starting point to this node. 
	 */
	private double gCost;
	
	public double getgCost() {
		return gCost;
	}

	public void setgCost(double gCost) {
		this.gCost = gCost;
	}
	
	
	/**
	 * Holds the estimated cost to move from this node to the ending point.
	 */
	private double hCost;
	
	public double gethCost() {
		return hCost;
	}

	public void sethCost(double hCost) {
		this.hCost = hCost;
	}
	
	
	public double getfCost() {
		return gethCost()+getgCost();
	}
	
}
